{% extends 'layout.html' %}

{% set title = 'c/' + community %}

{% block content %}

    <div class="community">

        <div class="about">
            <div>
                <b>{{ community_data.name }}</b>
            </div>

            <p>
                <span title="Description">{{ community_data.description }}</span>
            </p>

            {% if user %}
            <div>
                {% if community_data.allow_new_posts %}
                <a href="{{ url('submit', community=community_data.name) }}" class="flex-item button button_ok">
                    Submit
                </a>
                {% endif %}

                {% if is_member %}
                <form action="" method="POST" class="flex-item button">
                    <input type="submit" name="leave" value="Leave community" class="button button_transparent" />
                </form>
                {% else %}
                <form action="" method="POST" class="flex-item button">
                    <input type="submit" name="join" value="Join community" class="button button_transparent" />
                </form>
                {% endif %}
            </div>
            {% endif %}

            <div>
                Members: {{ community_data.members_count }}
            </div>
            <div>
                Moderators:
                {% for mod in moderators %}
                    <a href="{{ url('user_public', username=mod.username) }}">{{ mod.username }}</a>
                {% endfor %}
            </div>
            <div>
                Since: <span title="{{ community_data.created }}">{{ community_data.created|ago }}</span>
            </div>

            {% if is_moderator %}
            <a href="{{ url('community_administration', community=community_data.name) }}">
                Administration
            </a>
            {% endif %}
        </div>

        {% include 'posts.html' %}

    </div>

{% endblock %}
